--- configure.in.orig	Tue Sep  4 07:09:52 2012
+++ configure.in	Tue Dec 25 21:50:38 2012
@@ -62,15 +62,20 @@ if test "$cet" = "default"; then
 fi
 
 AC_MSG_CHECKING(whether to support shapefiles)
-AC_ARG_ENABLE(shapefile,
-  [  --enable-shapefile=[(yes)|no]],
-  [ enable_shapefile="$enableval"],[enable_shapefile="yes"])
-    if test "$enable_shapefile" != "no" ; then
+AC_ARG_WITH(shapefile, [  --enable-shapefile=[(included)|system|no]])
+  case $with_shapefile in
+    "system")
+	AC_CHECK_LIB([shp], [SHPOpen])
         AC_DEFINE(SHAPELIB_ENABLED, 1, [1 to enable shapefile support])
-	AC_MSG_RESULT(yes)
-    else
+	;;
+    "no")
 	AC_MSG_RESULT(no)
-    fi
+	;;
+    *)         SHAPE="\$(SHAPE)"
+        AC_DEFINE(SHAPELIB_ENABLED, 1, [1 to enable shapefile support])
+	AC_MSG_RESULT(using included version)
+	;;
+  esac
 
 AC_MSG_CHECKING(whether to support Palm/OS pdb formats)
 AC_ARG_ENABLE(pdb,
@@ -223,32 +228,8 @@ AC_SUBST(USB_LIBS)
 AC_SUBST(USB_CFLAGS)
 AC_SUBST(OSJEEPS)
 AC_SUBST(GBSER)
+AC_SUBST(SHAPE)
 AC_SUBST(ZLIB)
-
-dnl Linux HID support
-case "$target" in
-	*-linux-*)
-	AC_MSG_CHECKING(for Linux HID interface)
-	AC_COMPILE_IFELSE([
-		#include <sys/ioctl.h>
-		#include <linux/types.h>
-		#include <linux/hiddev.h>
-		#include <linux/hidraw.h>
-		void f(void) {
-			struct hidraw_devinfo info;
-			struct hiddev_field_info finfo;
-			struct hiddev_usage_ref_multi urefm;
-			struct hiddev_report_info rinfo;
-			ioctl(0, HIDIOCGRAWINFO, &info);
-			ioctl(0, HIDIOCGFIELDINFO, &finfo);
-			ioctl(0, HIDIOCSUSAGES, &urefm);
-			ioctl(0, HIDIOCSREPORT, &rinfo);
-		}],
-		AC_MSG_RESULT(yes)
-		AC_DEFINE(HAVE_LINUX_HID, 1, [Defined if you have Linux HID]),
-		AC_MSG_RESULT(no))
-	;;
-esac
 
 AC_MSG_CHECKING(for random stuff to make you feel better)
 AC_MSG_RESULT(failed)
